package Test1;

import javax.swing.JOptionPane;

public class Lottery {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String input = JOptionPane.showInputDialog ("How Many numbers do you need to draw?");
		int k = Integer.parseInt(input);
		
		input = JOptionPane.showInputDialog("What is the higest number you can draw?");
		int n = Integer.parseInt(input);

		/* 
		 * compute binomial coefficient
		 * n*(n-1) * (n-2)* ....* (n-k+1)
		 * ------------------------------
		 * 1*2*3*4*.....*k
		 * 
		 */
		
		int lotteryodds = 1;
		for (int i = 1; i <= k; i++)
			lotteryodds = lotteryodds * (n-i+1)/i;
		
		System.out.println("your odds are 1 in " +lotteryodds + ". !");
		
		System.exit(0);
		
	}

}
